<!doctype html>
<title>Array search</title>

<script>

var closet = [];

closet[0] = "hat";
closet[1] = "umbrella";
closet[2] = "katana";

//Search for umbrella

for(var i = 0; i < closet.length; i++)
{
  if(closet[i] === "umbrella")
  {
    console.log("Umbrella found at position: " + i);
    break;
  }
}

</script>